using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace SQLite.CodeFirst
{
    /// <summary>
    /// Represents the database table "history" which is used to store the necessary information
    /// to detect if the model has changed.
    /// </summary>
    [Table(nameof(History) + "_" + TableNamePostfix)]
    public class History : IHistory
    {
        /// <summary>
        /// The postfix which is appended to the history table name 
        /// to ensure that this table name is unique.
        /// </summary>
        public const string TableNamePostfix = "82c009b41631-48579635f1ff64eb62d9";

        /// <summary>
        /// Gets or sets the identifier of the record.
        /// <remarks>Is automatilcally generated by the database.</remarks>
        /// </summary>
        /// <value>
        /// The identifier.
        /// </value>
        [Key]
        public int Id { get; set; }

        /// <summary>
        /// Gets or sets the hash which represents the current database structure/state.
        /// </summary>
        /// <value>
        /// The hash.
        /// </value>
        [Required]
        public string Hash { get; set; }

        /// <summary>
        /// Gets or sets the key of the DbContext to which this record belongs.
        /// </summary>
        /// <value>
        /// The context key.
        /// </value>
        public string Context { get; set; }

        /// <summary>
        /// Gets or sets the create date of the record.
        /// </summary>
        /// <value>
        /// The create date.
        /// </value>
        [Required]
        public DateTime CreateDate { get; set; }
    }
}